﻿using System;
using System.Collections.Generic;

using Takkou.Core;

// signature of an action. Used as a function pointer type.
public delegate bool ActionType (params object[] args);
public delegate bool StopCondition ();

namespace Takkou.Language
{
    public class Command : Block
    {
        public string Name { get; private set; }

        protected Var[] param;
        protected object[] args;

        public Command(string name, params Var[] par)
        {
            //
        }

        public override void start()
        {
            base.start();
            // TODO check if args have the same types of param
        }

        public bool call(params object[] values)
        {

            return true;
        }

        public override bool execute()
        {
            return true;
        }
    }

    public class ActionCommand : Statement
    {
        // public string Name { get; private set; }
        public object[] Args { get; private set; }

        private ActionType doAction;

        public ActionCommand(ActionType action, params object[] args)
        {
            Args = args;
            doAction = action;
        }

        public override bool execute()
        {
            return doAction(Args);
        }
    }
}